apiready = function() {
    seajs.use(['../../V', "../../api", "../../jquery", "../../app", "../../service"], function(V, $api, $, $app, service) {
      $app.ready();
        var vm = {
            el: '.container',
            data: {
                list: [],
                activeIndex: 0,
                all_list: '',
                pictrue_list: '',
                score: 0,
                page: 1,
                is_img: false,
                have_data: true
            },
            methods: {
                init: function() {
                    if (this.have_data) {
                        this.getList(false);
                    }
                },
                getList: function(isNull) {
                    var unionid = $api.getStorage("shop_unionid");
                    var self = this;
                    var _isNull = isNull || false;
                    $app.ajax(service.buyMyCommentList, {
                        data: {
                            values: {
                                unionid: unionid,
                                order_state: self.score,
                                page: self.page
                            }
                        }
                    }, function(res) {
                        console.log("myComment: " + JSON.stringify(res));
                        if (res.code == 0) {
                            if (_isNull) {
                                self.list = [];
                            }
                            if (res.data.length > 0 && Array.isArray(res.data)) {
                                var data = res.data;
                                for (var i = 0; i < data.length; i++) {
                                    self.list.push(data[i]);
                                }
                                self.page++;
                            }
                            self.have_data = res.data.length <= 0 ? false : true;
                            document.querySelector("#myCommentNull").style.display = self.list.length <= 0 ? "block" : "none";
                        }
                    });
                },
                //--tab切换
                myCommentTab: function(et) {
                    var index = +et.target.dataset.index;
                    this.activeIndex = index;
                    if (index == 1) {
                        this.is_img = true;
                    } else {
                        this.is_img = false;
                    }
                },
                //--商品详情
                goGoodeDetail: function(et) {
                    var goods_id = et.currentTarget.dataset.goodsid;
                    $app.goGoodsDetail(goods_id);
                },
                //--查看大图
                lookBigImg: function(et) {
                    var ul = et.currentTarget.parentNode.querySelectorAll("img");
                    var index = +et.currentTarget.dataset.index;
                    var imgSrc = [];
                    for (var i = 0; i < ul.length; i++) {
                        imgSrc.push(ul[i].src.replace(/\?x-oss-process=image\/resize,m_lfit,w_960/g, ''));
                    }
                    api.openWin({
                        name: 'lookBigImg',
                        url: 'widget://src/Shop/buy_person/big_img.html',
                        reload: true,
                        animation: {
                            type: "movein",
                            subType: "from_right",
                            duration: 200
                        },
                        pageParam: {
                            src: imgSrc,
                            idnex: index
                        }
                    });
                }
            },
            mounted: function() {

            },
            created: function() {
                this.init();
            },
        };
        //var shopVue = new Vue(vm);
        var even = function() {

        };
        var newVue = new Vue(vm);
        even();

    })
}
